 <?php
include 'db.php';
	
$username=$_GET['u'];
$myuser=$_GET['m'];

$q=mysql_query("SELECT sessionid FROM sessions WHERE tutor='{$username}' ORDER BY sessionid DESC LIMIT 1");

while($data = mysql_fetch_row($q)){
	$a=mysql_query("UPDATE sessions SET `student`='{$myuser}' WHERE `sessionid`={$data[0]}");
	echo $data[0];
}

mysql_close($link);
?>
